package person.bing.fbcloud.leetcode;

/**
 * @author: mengfanbing
 * @date: 2020/8/28 9:53
 */
public class Q657 {
    public static void main(String[] args) {

    }
    public static boolean judgeCircle(String moves) {
        int left = 0;
        int up = 0;
        char[] chars = moves.toCharArray();
        for (char ch:chars){
            if (ch == 'L'){
                left++;
            }else if (ch == 'R'){
                left--;
            }else if (ch == 'U'){
                up++;
            }else if (ch == 'D'){
                up--;
            }
        }
        if (left == 0 && up == 0){
            return true;
        }
        return false;
    }
}
